package com.hefei

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @author caizhengjun
 * @date 2020/8/27 8:40 下午
 */
object RDDTest2 {
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf().setMaster("local[2]").setAppName(this.getClass.getSimpleName)

    val sc: SparkContext = new SparkContext(conf)

    val intRDD: RDD[Int] = sc.parallelize(Seq(1, 2, 3, 4, 5, 6))

    val mapResultRDD: RDD[Int] = intRDD.map(_ * 10)

    //mapResultRDD.foreach(println(_))

    val ints: Array[Int] = mapResultRDD.collect()

    ints.foreach(println(_))
  }
}
